import { Context } from 'koa';
import KoaRouter from 'koa-router';

const router: KoaRouter = new KoaRouter({ prefix: '/user' });

interface User {
    id: number;
    username: string;
    password: string;
}

router.get('/',(ctx:Context,next:Function)=>{
    ctx.body = 'user';
})
router.post('/',(ctx:Context,next:Function)=>{
    const user:User = ctx.request.body;
    if(user==undefined||user==null) return
    ctx.body = {
        code:200,
        msg:'success',
        data:JSON.stringify(user)
    };
})

module.exports = router;